<?php
namespace LDL\Twspider;
use Symfony\Component\Finder\Exception\AccessDeniedException;

use VDB\Spider\Uri\DiscoveredUri;
use VDB\Spider\RequestHandler\GuzzleRequestHandler;
use GuzzleHttp\Client;
use LDL\Twspider\E\TwspiderFactory ; 
//use E\FixThreadLoad;
class Twspider extends \VDB\Spider\Spider {
 //线程个数
	//private $thread_count;

	/**
	 * @var E\ConsoleLog
	 */

   	public $logger ;
   	public $spiderMeta;
    //开始爬取的URL
   // private   $seed  ; moidfy parent
	//

	public function __construct($seed, TwspiderFactory $spiderFactory,$spiderId = null)
    {
	//new \VDB\Spider\RequestHandler\GuzzleRequestHandler();
        parent::__construct($seed,$spiderId);

	//	$this->thread_count = $thread_count;
 //       $this->getDownloader()->setRequestHandler(new GuzzleRequestHandler());//
		E\FixThreadLoad::fix($spiderFactory->loadedFiles());

    }
	//public  $data=[] ;

	public function prepareCrawl(){

      //  parent::getQueueManager();
       // debug($_Q);
		//$this->getQueueManager()->addUri($this->getSeed());
        	$this->getDownloader()->getPersistenceHandler()->setSpiderId($this->getSpiderId());//
	//	$this->_pool->collect(function($task){ echo $task->worker->getThreadId()."xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" ;return  false ;});
	//       echo $c."_____\n";

		//parent::crawl();
	}



}

